<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pages extends CI_Controller {

	public function index()
	{
    // Get the page URI
		$page = $this->uri->segment(1);
		
		$data['page'] = TRUE;
		
    // select page view
    // views located under `pages/template_name.php`
		switch($page)
		{
  		case '':
  		case 'index':
  		case 'home':
  		  $data['page_title'] = title();
  		  $template           = 'home';
  		  break;
  		
  		default:
  		  $data['title'] = title($page);
  		  $template      = $page;
		}
		
		$this->load->view("templates/header", $data);
		$this->load->view("pages/$template", $data);
		$this->load->view("templates/footer", $data);
	}
}

// End of File